<template>
    <div style="width: 100%">
        <el-table
            :data="tableData"
            border
            highlight-current-row
            stripe
            style="width: 100%"
            :row-style="rowStyle"
            :cell-style="cellStyle"
        >
            <el-table-column
                :key="table.prop"
                v-for="table in tableHeader"
                :label="table.label"
                :prop="table.prop"
                align="center"
                :width="table.width"
            />
            <el-table-column
                label="操作"
                align="center"
                width="120px"
                fixed="right"
            >
                <!--        操作按钮区域的作用域插槽-->
                <template slot-scope="scope">
                    <el-tooltip
                        effect="dark"
                        content="查看简历"
                        placement="top"
                    >
                        <el-button
                            type="info"
                            icon="el-icon-view"
                            circle
                            @click="editDialogVisible1(scope.row)"
                        />
                    </el-tooltip>
                </template>
            </el-table-column>
        </el-table>
        <el-dialog
            title="查看简历"
            :visible.sync="editDialogVisible"
            width="50%"
            :close-on-click-modal="false"
        >
            <!--      对话框主体区域-->
            <el-form
                :model="editForm"
                label-width="100px"
            >

                <el-form-item
                    label="名字"
                >
                    <el-input v-model="editForm.name"/>
                </el-form-item>

                <el-form-item
                    label="绑定专业"
                >
                    <el-input v-model="editForm.profession"/>
                </el-form-item>

                <el-form-item
                    label="邮箱"
                    prop="email"
                >
                    <el-input v-model="editForm.email"/>
                </el-form-item>

                <el-form-item
                    label="在校排行"
                >
                    <el-input v-model="editForm.gradesRanking"/>
                </el-form-item>

                <el-form-item
                    label="荣誉奖项"
                >
                    <el-input type="textarea" v-model="editForm.honor"/>
                </el-form-item>

                <el-form-item
                    label="项目经历"
                >
                    <el-input type="textarea" v-model="editForm.projectExperience"/>
                </el-form-item>

                <el-form-item
                    label="校园经历"
                >
                    <el-input type="textarea" v-model="editForm.experienceSchool"/>
                </el-form-item>

                <el-form-item
                    label="自我评价"
                >
                    <el-input type="textarea" v-model="editForm.selfIntroduction"/>
                </el-form-item>

                <el-form-item
                    label="实习经历"
                >
                    <el-input type="textarea" v-model="editForm.internExperience"/>
                </el-form-item>

            </el-form>
            <!--      对话框底部区域-->
            <span
                slot="footer"
                class="dialog-footer"
            >
        <el-button @click="editDialogVisible = false">关闭</el-button>
      </span>
        </el-dialog>
    </div>
</template>

<script>
	export default {
		name: 'resumeList',
        data(){
		    return{
                tableData: [],
                tableHeader: [
                    { label: '姓名', prop: 'name', width: 150 },
                    { label: '专业', prop: 'profession', width: 150},
                    { label: '邮箱', prop: 'email' ,width: 220},
                    { label: '在校成绩排名', prop: 'gradesRanking' ,width: 200},
                    { label: '荣誉奖项', prop: 'honor' ,width: 400},
                    { label: '项目经历', prop: 'projectExperience',width: 400 },
                    { label: '校园经历', prop: 'experienceSchool' ,width: 400},
                    { label: '技能证书', prop: 'certificate' ,width: 400},
                    { label: '自我评价', prop: 'selfIntroduction' ,width: 400},
                    { label: '实习经历', prop: 'internExperience' ,width: 400}
                ],
                postId:'',
                editDialogVisible: false,
                editForm:{
                    resumeId :'',
                    /**
                     * 发送人
                     */
                    fromId:'',
                    /**
                     * 姓名
                     */
                    name:'',
                    /**
                     * 专业
                     */
                    profession:'',
                    email:'',
                    /**
                     * 在校成绩排名
                     */
                    gradesRanking:'',
                    /**
                     * 荣誉奖项
                     */
                    honor:'',
                    /**
                     * 项目经历
                     */
                    projectExperience:'',
                    /**
                     * 校园经历
                     */
                    experienceSchool:'',
                    /**
                     * 技能证书
                     */
                    certificate:'',
                    /**
                     * 自我评价
                     */
                    selfIntroduction:'',
                    /**
                     * 实习经历
                     */
                    internExperience:''
                }
            }
        },
        created () {
            const postId = this.$route.query.postId
            if (postId !== undefined && postId !== '') {
               this.postId = postId;
            }
            this.getResumeList()
        },
        methods :{
            getResumeList(){
                let self = this;
                let postId = self.postId;
                self.utils.sendReq({
                    queryUrl:`/resume/getPostResume/${postId}`,
                    req:{
                        method:'get',
                        success:function (req) {
                            if (req.data.code == 200){
                                self.tableData = req.data.data;
                            }
                        }
                    }
                })
            },
            editDialogVisible1(data){
                this.editForm = JSON.parse(JSON.stringify(data))
                this.editDialogVisible = true
            },
            rowStyle (row, rowIndex) {
                return 'height : 35px'
            },
            cellStyle () {
                return 'padding : 2px'
            }
        }
    }
</script>

<style scoped>

</style>
